package com.awx.client.navigation.menu;

import java.awt.Component;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JMenu;

import com.awx.client.navigation.AwxController;

public class AwxMenuGroup implements Serializable{

	private List<AwxMenuItem> menuItems;
	private String name;

	public AwxMenuGroup( String menuName ) {
		this.name = menuName;
		this.menuItems = new ArrayList<AwxMenuItem>();
	}

	public JMenu buildMenu(AwxController controller) {
		JMenu menu = new JMenu( name );
		for (AwxMenuItem menuItem : this.menuItems) {
			menu.add( menuItem.buildMenuItem( controller ) );
		}
		return menu;
	}

	public void addMenuItem( AwxMenuItem menuItem ) {
		this.menuItems.add( menuItem );
	}

}
